package com.atguigu.sugar.mapper;

import com.atguigu.sugar.bean.Province;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2022/1/7 14:23
 */
public interface ProvinceMapper {
    
    @Select("SELECT\n" +
        "    province_name,\n" +
        "    sum(order_amount) AS order_amount,\n" +
        "    sum(order_count) AS order_count\n" +
        "FROM province_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date} and province_name != ''\n" +
        "GROUP BY province_name\n")
    List<Province> statsByProvince(@Param("date") int date);
}
